package core;

import java.io.Serializable;

public class Problem implements Cloneable, Serializable {
private static final long serialVersionUID = -946203437271277164L;
	
	private int[][] flux;
	private int[][] destination;
	private int[] permutation;
	private int size;
	private double cost;
	private int generation;

	public Problem(){}
	
	//metodos auxiliares
	public void ChangeDestinationLine(int firstLine, int secondLine){
		int[] temp = new int[size];
		for (int i = 0; i < temp.length; i++) {
			temp[i] = destination[firstLine][i]; //copia conteudo da 1 linha em uma var temporaria
			destination[firstLine][i] = destination[secondLine][i]; //cola conteudo da 2 linha na 1
			destination[secondLine][i] = temp[i]; //cola conteudo da var temporaria na 2 linha
		}
		//System.out.println();
	}
	
	public void ChangeDestinationColumn(int firtsCol, int secondCol){
		int[] temp = new int[size];
		for (int i = 0; i < temp.length; i++) {
			temp[i] = destination[i][firtsCol]; //copia conteudo da 1 linha em uma var temporaria
			destination[i][firtsCol] = destination[i][secondCol]; //cola conteudo da 2 linha na 1
			destination[i][secondCol] = temp[i]; //cola conteudo da var temporaria na 2 linha
		}
	}
	
	public String PrintPermutation(){
		String ret = "";
		for (int i = 0; i < permutation.length; i++) {
			ret += permutation[i]+"  ";
		}
		return ret;
	}
	
	public void setPermutationElement(int index, int content){
		permutation[index] = content;
	}
	
	public int getPermutationElement(int index){
		return permutation[index];
	}
	
	public void makeInitialPermutation(){
		permutation = new int[size];
		//faz a permutacao inicial
		for (int i = 0; i < size; i++) {
			permutation[i] = i;
		}
	}
	
	//get e set
	public int[][] getFlux() {
		return flux;
	}

	public void setFlux(int[][] flux) {
		this.flux = flux;
	}

	public int[][] getDestination() {
		return destination;
	}

	public void setDestination(int[][] destination) {
		this.destination = destination;
	}

	public int[] getPermutation() {
		return permutation;
	}

	public void setPermutation(int[] permutation) {
		this.permutation = permutation;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public double getCost() {
		return cost;
	}

	public void setCost(double cost) {
		this.cost = cost;
	}

	public int getGeneration() {
		return generation;
	}

	public void setGeneration(int generation) {
		this.generation = generation;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	
}
